﻿using System;
using System.Collections.Generic;
using System.Text;
using Slf;

namespace _04._01_Diagnosing_Invalid_Factories
{
  class Program
  {
    static void Main(string[] args)
    {
      Console.ForegroundColor = ConsoleColor.Green;
      Console.WriteLine("In this sample, App.config was configured with invalid settings - the declared class just does not exist.");
      Console.Write("However, this will not crash SLF. Instead, SLF returns a NullLogger, and logs a warning to the Debug output. ");
      Console.Write("If you start this application in debug mode, you should see SLF's warnings in Visual Studio Output window.\n\n");
      Console.ResetColor();


      //the service cannot resolve the configuration
      ILogger logger = LoggerService.GetLogger("logger1");
      Console.WriteLine("Logger type returned when requesting 'logger1': " + logger.GetType());

      logger = LoggerService.GetLogger("logger2");
      Console.WriteLine("Logger type returned when requesting 'logger2': " + logger.GetType());

      Console.ReadLine();
    }
  }
}
